import java.util.Scanner;

public class main {
    public static void main(String[] args) {
        //求两个正整数的最大公约数
        int a = 0;
        int b = 0;
        Scanner scanner = new Scanner(System.in);
        a = scanner.nextInt();
        b = scanner.nextInt();
        while(true) {
            int c = a % b;
            if(c == 0) {
                break;
            }
            a = b;
            b = c;
        }
        System.out.println("最大公约数是:" + b);
    }
}
